// Echarts图表字体、间距自适应
export const fitChartSize = (size, defalteWidth = 1920) => {
  const clientWidth =
    window.innerWidth ||
    document.documentElement.clientWidth ||
    document.body.clientWidth
  if (!clientWidth) return size
  const scale = clientWidth / defalteWidth
  return Number((size * scale).toFixed(3))
}

// 提示框样式统一配置
export const tooltipOptions = {
  trigger: 'item',
  axisPointer: {
    type: 'shadow',
  },
  backgroundColor: 'rgba(27, 44, 64, 0.8)',
  textStyle: {
    color: '#fff',
    fontSize: fitChartSize(12),
    fontFamily: 'DDin',
  },
}
